<?php echo view('header.html');?>

<body class="layui-view-body bgwhite">
	<div class="layui-content">
		<div class="layui-row">
			<div class="layui-card">

				<div class="layui-card-body">

					<div class="form-list-table">
						<div class="layui-form ">

							<div class="layui-row layui-col-space15">
								<!--左侧 主要内容-->
								<div class="layui-col-md12">

									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>平台名称:</label>
										<div class="layui-input-block">
											<input type="text" name="data[name]" value="<?=$data['name'] ?? ''?>" class="layui-input">
											<span class="help-block">起个名字便于识别</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>平台标识:</label>
										<div class="layui-input-block">
											<input type="text" name="data[code]" value="<?=$data['code'] ?? ''?>" class="layui-input">
											<span class="help-block">纯字母如 aliyunoss qiniu ...</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>类文件名称:</label>
										<div class="layui-input-block">
											<input type="text" name="data[filename]" value="<?=$data['filename'] ?? ''?>" class="layui-input">
											<span class="help-block">区分大小写纯字母如 QiNiu ...</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>Key:</label>
										<div class="layui-input-block">
											<input type="text" name="data[key]" value="<?=$data['key'] ?? ''?>" class="layui-input">
											<span class="help-block"></span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>Secret:</label>
										<div class="layui-input-block">
											<input type="text" name="data[secret]" value="<?=$data['secret'] ?? ''?>" class="layui-input">
											<span class="help-block"></span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">bucket:</label>
										<div class="layui-input-block">
											<input type="text" name="data[bucket]" value="<?=$data['bucket'] ?? ''?>" class="layui-input">
											<span class="help-block">存储平台上的 bucket name</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">访问URL:</label>
										<div class="layui-input-block">
											<input type="text" name="data[url]" value="<?=$data['url'] ?? ''?>" class="layui-input">
											<span class="help-block"></span>
										</div>
									</div>

								</div>


							</div>

							<div class="layui-form-item">
								<label class="layui-form-label"></label>
								<div class="layui-input-block">
									<button class="layui-btn layui-btn-blue" lay-submit="" lay-filter="ams_submit">提交保存</button>
								</div>
							</div>

						</div>
					</div>

				</div>
			</div>
		</div>
	</div>
	<?php echo view('footer.html');?>
	<script type="text/javascript">
		layui.use(['form', 'jquery', 'layer', 'laydate', 'upload'], function () {
			var $ = layui.jquery,
				form = layui.form,
				layer = layui.layer,
				laydate = layui.laydate;
			


			laydate.render({
				elem: '#endtime'
			});

			var url = window.location.href;

			form.on('submit(ams_submit)', function (data) {
				$.post(url, data.field, function (res) {
					if (res.code == 0) {
						layer.msg(res.msg, { icon: 1, time: 1500 }, function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							// parent.location.href = adminpath + '/role/index';
							parent.location.reload();
							parent.layer.close(index);
							// location.href = adminpath + 'admin/combo/index';
						});
					} else {
						layer.msg(res.msg, { icon: 5, time: 1500 });
					}
				}, 'json');
				return false;
			});

		});

	</script>
</body>

</html>
